# -*- coding: utf-8 -*-
"""
author:码同学 极光
date:2025/3/1
desc: 
sample: 
"""
class Person:
    country = "中国" #全局

    @staticmethod  # 静态方法并不是真正意义上的类方法，它只是一个被放到类里的函数而已
    def show():
        print(Person.country)

    def __init__(self, name, age):
        self.name = name
        self.age = age

    def say_hello(self,to='lisi'):
        print(f'hello, my name is {self.name}, and I am {self.age} years old.和{to}打招呼')

    @property
    def say_goodbye(self):
        print('goodbye, my name is %s, and I am %d years old.' % (self.name, self.age))


print(Person.show())
print(Person.country)

p1 =Person(name='zhangsan', age=18)
p1.say_hello()
p2= Person(name='lisi', age=20)
p2.say_goodbye #属性 还是方法？
print(p2.age)
print(p2.country)

class Stu(Person):
    def __init__(self, name, age, score):
        super().__init__(name, age)
        self.score = score

    def say_hello(self,to='lisi'):
        print(f'hello, my name is {self.name}, and I am {self.age} years old.和{to}打招呼,并且告诉他我考了{self.score}分')

    def __str__(self) -> str:
        return f'我想打印的是 is {self.name}, and I am {self.age} years old.'


stu1 = Stu(name='wangwu', age=20, score=100)
stu1.say_hello('张三')
print(stu1)

class Teacher(Person):
    def __init__(self, name, age, title):
        super().__init__(name, age)
        self.title = title